/***
 * 
 */
define( [ 'Vue', 'axios' ], function ( Vue, axios ) {
    return Vue.component('MetricRef', {
        props: ['host', 'port', 'metricKey'],

        data: function() {
            return {
                refList: []
            };
        },

        mounted : function () {
            var _this = this;

            axios.get( 'metric-ref.json?metricKey=' + this.metricKey + '&host=' + this.host +'&port=' +this.port ) .then(function (response) {
                if ( 'string' == typeof response.data.Content ) {
                    return;
                }

                _this.refList = response.data;
            });
        },

        template : `
            <div :title="JSON.stringify(refList)">
                <b v-if="refList.length > 0" style="color:red;">{{refList.length}}</b>
                <span v-else>{{refList.length}}</span>
            </div>
        `
    });
});